<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>One Tooltip, Many Context Elements</title>

<style type="text/css">
/*margin and padding on body element
  can introduce errors in determining
  element position and are not recommended;
  we turn them off as a foundation for YUI
  CSS treatments. */
body {
	margin:0;
	padding:0;
}
</style>

<link rel="stylesheet" type="text/css" href="../../build/fonts/fonts-min.css" />
<link rel="stylesheet" type="text/css" href="../../build/container/assets/skins/sam/container.css" />
<script type="text/javascript" src="../../build/yahoo-dom-event/yahoo-dom-event.js"></script>
<script type="text/javascript" src="../../build/container/container.js"></script>

<!--there is no custom header content for this example-->

</head>

<body class=" yui-skin-sam">

<h1>One Tooltip, Many Context Elements</h1>

<div class="exampleIntro">
	<p>In the example below, a single Tooltip instance is used to create tooltips for each link in the list.</p>			
</div>

<!--BEGIN SOURCE CODE FOR EXAMPLE =============================== -->

<div id="container"></div>


<script>
		YAHOO.namespace("example.container");

		function init() {
			var contextElements = [];

			for (var i=1;i<=11;i++) {
				var a = document.createElement("a");
				a.id = "link" + i;
				a.href = "http://www.yahoo.com/";
				a.title = "This is link number " + i;
				a.innerHTML = i + ".  Hover over me to see my Tooltip";

				elContainer = YAHOO.util.Dom.get("container");
				elContainer.appendChild(a);
				elContainer.appendChild(document.createElement("br"));
				elContainer.appendChild(document.createElement("br"));
			
				contextElements[contextElements.length] = a.id;
			}

			YAHOO.example.container.tt = new YAHOO.widget.Tooltip("tt", { context:contextElements } );
		}

		YAHOO.util.Event.addListener(window, "load", init);
</script>

<!--END SOURCE CODE FOR EXAMPLE =============================== -->

</body>
</html>